package com.xiyu.service.controller.admin.area;
import com.xiyu.service.vo.area.officeArea.OfficeAreaSimpleListOutput;
import com.xiyu.service.vo.area.officeArea.OfficeAreaSingleGetOutput;
import com.xiyu.service.vo.area.officeArea.OfficeAreaUpdateInput;
import com.xiyu.service.vo.area.officeArea.OfficeAreaCreateInput;
import com.xiyu.service.vo.area.officeArea.OfficeAreaPageQueryOutput;
import com.xiyu.service.vo.area.officeArea.OfficeAreaPageQueryInput;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import jakarta.validation.*;

import java.util.*;

import com.xiyu.service.framework.web.web.core.pojo.PageResult;
import com.xiyu.service.framework.web.web.core.pojo.CommonResult;
import static com.xiyu.service.framework.web.web.core.pojo.CommonResult.success;

import com.xiyu.service.framework.excel.core.util.ExcelUtils;

import com.xiyu.service.framework.operateLog.core.annotations.OperateLog;
import static com.xiyu.service.framework.operateLog.core.enums.OperateTypeEnum.*;

import com.xiyu.service.service.area.OfficeAreaService;

@Tag(name = "办公区")
@RestController
@RequestMapping("/area/office-area")
@Validated
public class OfficeAreaController {

    @Resource
    private OfficeAreaService officeAreaService;

    @GetMapping("/page-query")
    @Operation(summary = "分页查询办公区")
    public CommonResult<PageResult<OfficeAreaPageQueryOutput>> pageQuery(@Valid OfficeAreaPageQueryInput inputVO) {
        return success(officeAreaService.pageQuery(inputVO));
    }

    @PostMapping("/create")
    @Operation(summary = "新增办公区")
    public CommonResult<Long> create(@Valid @RequestBody OfficeAreaCreateInput inputVO) {
        return success(officeAreaService.create(inputVO));
    }

    @PutMapping("/update")
    @Operation(summary = "更新办公区")
    public CommonResult<Boolean> update(@Valid @RequestBody OfficeAreaUpdateInput inputVO) {
        return success(officeAreaService.update(inputVO));
    }

    @GetMapping("/single-get")
    @Operation(summary = "获取单个办公区")
    @Parameter(name = "id", description = "办公区主键ID", example = "")
    public CommonResult<OfficeAreaSingleGetOutput> singleGet(@RequestParam("id") Long id) {
        return success(officeAreaService.singleGet(id));
    }

    @GetMapping("/simple-list")
    @Operation(summary = "查询")
    public CommonResult<List<OfficeAreaSimpleListOutput>> simpleList() {
        return success(officeAreaService.simpleList());
    }

}
